package o;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.huawei.appmarket.service.activitydispatcher.OpenGateway.Param;
import com.huawei.appmarket.service.activitydispatcher.OpenGateway.c;
import com.huawei.appmarket.service.activitydispatcher.OpenGateway.d;
import com.huawei.appmarket.service.activitydispatcher.OpenGateway.e;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class dpd extends e {
    private static final List<String> ˋ = new ArrayList();
    private static final Map<String, d> ˏ = new HashMap();

    public static void ˋ(String str, String str2) {
        ˏ.put(str + "@@@" + str2, null);
    }

    public c ˋ(String str, List<Param> list, boolean z) {
        if (TextUtils.isEmpty(str)) {
            Logger.e("ActivityModuleProvider", "can not find activityName");
            return null;
        } else if (ˋ.contains(str)) {
            Logger.e("ActivityModuleProvider", "prohibit open：" + str);
            return null;
        } else if (!z || ˏ.containsKey(str)) {
            List ॱ;
            d dVar = (d) ˏ.get(str);
            if (dVar != null) {
                ॱ = dVar.ॱ(list);
            }
            if (!z || dVar == null || dVar.ˋ(ॱ)) {
                String[] split = str.split("@@@");
                if (split.length != 2) {
                    return null;
                }
                String str2 = split[0];
                String str3 = split[1];
                fhz ˋ = fho.ˏ().ˋ(str2);
                if (ˋ == null) {
                    Logger.e("ActivityModuleProvider", "can not find module:" + str2);
                    return null;
                }
                fjb ˎ = ˋ.ˎ(str3);
                if (ˎ == null) {
                    Logger.e("ActivityModuleProvider", "can not find uiModule:" + str3);
                    return null;
                }
                c.c ˎ2 = ˎ(ॱ, ˎ);
                if (ˎ2 == null) {
                    return null;
                }
                c cVar = new c();
                cVar.ˋ(ˎ2);
                return cVar;
            }
            Logger.ˎ("ActivityModuleProvider", "param limited.");
            return null;
        } else {
            Logger.ˎ("ActivityModuleProvider", "activityName limited.");
            return null;
        }
    }

    private c.c ˎ(List<Param> list, fjb o_fjb) {
        c.c cVar = new c.c();
        cVar.ˋ = o_fjb;
        if (list == null) {
            return cVar;
        }
        if (o_fjb.ˋ().ˋ().isInterface()) {
            return ॱ(list, cVar);
        }
        return ˎ((List) list, cVar);
    }

    @Nullable
    private c.c ˎ(List<Param> list, c.c cVar) {
        Bundle bundle = new Bundle();
        if (e.ˎ((List) list, bundle)) {
            Intent intent = new Intent();
            intent.putExtra("_protocol", bundle);
            cVar.ˏ = intent;
            return cVar;
        }
        Logger.e("ActivityModuleProvider", "param error,goMainActivity");
        return null;
    }

    @Nullable
    private c.c ॱ(List<Param> list, c.c cVar) {
        Object hashMap = new HashMap();
        for (Param ˊ : list) {
            if (!e.ˊ(ˊ, hashMap)) {
                Object obj = null;
                break;
            }
        }
        int i = 1;
        if (obj != null) {
            Intent intent = new Intent();
            Bundle bundle = new Bundle();
            bundle.putSerializable("mValues", hashMap);
            intent.putExtra("_protocol", bundle);
            cVar.ˏ = intent;
            return cVar;
        }
        Logger.e("ActivityModuleProvider", "param error,goMainActivity");
        return null;
    }
}
